{% extends "admin/bases.html" %}
 {% import "admin/fy.html" as pg %}

{% block content %}
    <div class="x-body">
<div class="layui-row">
               <form class="layui-form layui-col-md12 x-so" method="post">
            {{form.name}}
            {{form.gys}}

         {{form.csrf_token}}
          {{form.submit}}
        </form>
      </div>

      <table class="layui-table">
        <thead>

          <tr>

            <th>商品名称</th>
            <th>商品数量</th>
            <th>商品单价</th>
            <th>供应商名称</th>
            <th >操作</th>
            </tr>

        </thead>
        <tbody>

            {% for i in page_data.items %}
          <tr>


            <td>{{i.warehouse_goods_name}}</td>
             <td>{{i.warehouse_goods_num}}</td>
            <td>{{i.goods_price}}</td>
            <td>{{i.warehouse_supplier_name}}</td>
            <td class="td-manage">

              <a title="删除" onclick="member_del(this,'{{i.warehouse_id}}')" href="javascript:;">
                <i class="layui-icon">&#xe640;</i>
              </a>
            </td>
          </tr>
         {% endfor %}
        </tbody>
      </table>

     {{pg.page(page_data,'admin.seeWarehouse')}}

    </div>
    <script>

          function member_del(obj, id) {
              console.log(id)
              layer.confirm('确认要删除吗？', function (index) {
                  //发异步删除数据
                  $.get(
                      'http://127.0.0.1/admin/dellwarehouse?id=' + id,

                      function (html) {
                           location.reload();
                      }
                  );
                  $(obj).parents("tr").remove();
                  layer.msg('已删除!', {icon: 1, time: 1000});
              });
          }




    </script>

{% endblock %}